package com.yien.springstudy.controller;

import com.yien.springstudy.result.ResultVO;
import com.yien.springstudy.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * product controller
 *
 * @author Miaoxiong Fan
 * @since version
 */
@RestController
@RequestMapping("product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/calc")
    public void calcProductTotalPrice() {
        productService.calcTotalPrice();
    }

    @GetMapping("/list")
    public ResponseEntity<Object> list() {
        return ResultVO.success(productService.list());
    }
}
